//package com.example.ccb.utils;
//
//import cn.hutool.http.HttpUtil;
//import com.alibaba.fastjson.JSONObject;
//import com.example.ccb.bean.req.CcbRefundParamReq;
//import com.example.ccb.bean.vo.CCBEbsRefundVo;
//import com.example.ccb.bean.vo.CcbRefundVo;
//import com.kdzt.wxmp.config.CcbProperties;
//import com.kdzt.wxmp.model.ccb.req.CcbRefundParam;
//import com.kdzt.wxmp.model.ccb.vo.CCBEbsRefundResp;
//import com.kdzt.wxmp.model.ccb.vo.CcbRefundVo;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Component;
//
//import java.text.SimpleDateFormat;
//import java.util.Date;
//
///**
// * 建行外联http跑龙套
// *
// * @author Administrator
// * @date 2022/08/22
// */
//@Slf4j
//@Component
//@RequiredArgsConstructor
//public class WaiLianHttpUtils {
//
//
//
//
//    public CCBEbsRefundVo refund(String orderNo, String refundAmt, String payRecordNo) {
//        CcbRefundParamReq ccbRefundParam = refundParam(orderNo, refundAmt, payRecordNo);
//        String result = HttpUtil.post(ccbProperties.getRefundUrl(), JSONObject.toJSONString(ccbRefundParam));
//        System.out.println(result);
//        try {
//            CcbRefundVo ccbRefundVo = JSONObject.parseObject(result, CcbRefundVo.class);
//            if ("000000".equals(ccbRefundVo.getReturnCode())) {
//                CCBEbsRefundVo resp = new CCBEbsRefundVo();
//                resp.setOrderNum(ccbRefundVo.getOrderNum());
//                return resp;
//            }
//        } catch (Exception e) {
//            log.error("建行退款 转换失败  {}", result);
//        }
//
//
//        return null;
//    }
//
//
//    public CcbRefundParamReq refundParam(String orderNo, String refundAmt, String payRecordNo) {
//        //生成序列码
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
//        String REQUEST_SN = sdf.format(new Date());
//        CcbRefundParamReq ccbRefundParam = new CcbRefundParamReq();
//        ccbRefundParam.setMerchantId(ccbProperties.getMerchantId());
//        ccbRefundParam.setCustId(ccbProperties.getUserId());
//        ccbRefundParam.setTransPwd(ccbProperties.getTradePassword());
//        ccbRefundParam.setCertPassword(ccbProperties.getCertPassword());
//        ccbRefundParam.setTxCode("5W1004");
//        ccbRefundParam.setLanguage("CN");
//        ccbRefundParam.setUrl("https://merchant.ccb.com");
//        ccbRefundParam.setCertFilePath(ccbProperties.getCertFilePath());
//        ccbRefundParam.setConfigFilePath(ccbProperties.getConfigFilePath());
//        ccbRefundParam.setRefundNo(REQUEST_SN);
//        ccbRefundParam.setRefundAmt(refundAmt);
//        ccbRefundParam.setPayRecordNo(orderNo);
//        return ccbRefundParam;
//    }
//}
